PATHMac OS 8 Developer Documentation > Operating System Services > Multiprocessing Services >

Adding Multitasking Capability to Applications Using Multiprocessing Services

   

MPAllocateAligned

Allocates a nonrelocatable memory block.

LogicalAddress MPAllocateAligned (
                     ByteCount size,
                     UInt8 alignment,
                     OptionBits options);
size
A value of type ByteCount specifying the size, in bytes, of the memory block to allocate.
alignment
An integer specifying the desired alignment of the allocated memory block. See Memory Allocation Alignment Constants for a list of possible values to pass. Note that there will be a minimum alignment regardless of the requested alignment. If the requested memory block is 4 bytes or smaller, the block will be at least 4-byte aligned. If the requested block is greater than 4 bytes, the block will be at least 8-byte aligned.
options
A value of type OptionBits that specifies any optional information to use with this call. See Memory Allocation Option Constants for a list of possible values to pass.
function result
A pointer to the allocated memory. If the function cannot allocate the requested memory or the requested alignment, the returned address is NULL .
DISCUSSION

The memory referenced by the returned address is guaranteed to be accessible by the application's cooperative task and any preemptive tasks that it creates, but not by other applications or their preemptive tasks. Any existing nonglobal heap blocks are freed when the application terminates. As with all shared memory, you must explicitly synchronize access to allocated heap blocks using a notification mechanism.

You can replicate the effect of the older MPAllocate function by calling MPAllocateAligned with 32-byte alignment and no options.

VERSION NOTES

Introduced with Multiprocessing Services 2.0.

SEE ALSO

The function MPFree .


© 1999 Apple Computer, Inc. – (Last Updated 07 May 99)